package com.siyuanren.gcocp.exception;

import com.siyuanren.gcocp.common.exception.BaseException;
import lombok.extern.slf4j.Slf4j;

/**
 * @author guwr
 */
@Slf4j
public class GcocpException extends BaseException {

    public static final GcocpException USER_EXIST = new GcocpException(10001, "不能重复选择座位");
    public static final GcocpException SEAT_NON_EXISTENT = new GcocpException(10002, "选择的座位不存在");
    public static final GcocpException SEAT_OCCUPIED = new GcocpException(10003, "选择的座位已占用");
    public static final GcocpException ROLE_CONFLICT = new GcocpException(10004, "选择角色不正确");
    public static final GcocpException ACCOUNT_PASSWORD_ERROR = new GcocpException(10005, "帐号或密码错误");
    public static final GcocpException SEAT_IS_FULL = new GcocpException(10006, "座位已满");
    public static final GcocpException SEAT_NOT_IN = new GcocpException(10007, "座位不存在");
    public static final GcocpException SEAT_HAS_BEEN = new GcocpException(10008, "座位已有人");
    public static final GcocpException OLD_PASSWORD_ERROR = new GcocpException(10009, "原始密码不正确");
    public static final GcocpException PEOPLE_IS_FULL = new GcocpException(10010, "人数已满");
    public static final GcocpException ORDER_TIME_SELECT_EXIST = new GcocpException(10011, "该时间已被其他用户选择，请选择其他时间");
    public static final GcocpException ORDER_CONFIRM_YET = new GcocpException(10012, "订单已确认不能取消");
    public static final GcocpException ORDER_SCORE_NOT_NULL = new GcocpException(10013, "订单评分不能为空");
    public static final GcocpException ORDER_CANCEL_YET = new GcocpException(10014, "当前订单已取消，不能接单");
    public static final GcocpException ORDER_IS_NULL = new GcocpException(10015, "当前订单不存在");
    //用户
    public static final GcocpException SYRUSER_IS_EXIST = new GcocpException(20001, "用户已存在");
    public static final GcocpException TWO_PASSWORD_IS_INCONSISTENT = new GcocpException(20002, "两次密码不一致");
    public static final GcocpException MOBILE_IS_EXIST = new GcocpException(20003, "手机号码已存在");
    public static final GcocpException MOBILE_IS_ERROR = new GcocpException(20004, "手机号码错误");
    public static final GcocpException PASSWORD_LENGTH_IS_ERROR = new GcocpException(20005, "注册密码不能少于6位");
    public static final GcocpException MOBILE_IS_NULL = new GcocpException(20006, "手机号码不存在");
    public static final GcocpException LOGIN_ERROR = new GcocpException(20007, "登录失败，请稍候再试");
    public static final GcocpException USER_DATE_ERROR = new GcocpException(20008, "年龄选择有误");
    public static final GcocpException SEAT_SELECT_ERROR = new GcocpException(20009, "只有认证过心理咨询师才能提供咨询服务");
    public static final GcocpException NOT_STARTUP_READYGO = new GcocpException(20010, "双方有人离开座位，不能准备或开始");
    public static final GcocpException USER_REALNAME_ERROR = new GcocpException(20011, "真实姓名有误");
    public static final GcocpException USER_BLACK_IS_EXIST = new GcocpException(20012, "黑名单中已经存在");
    //验证码
    public static final GcocpException VERIFICATION_CODE_ERROR = new GcocpException(30001, "验证码错误");
    public static final GcocpException VERIFICATION_CODE_EXPIRED = new GcocpException(30002, "验证码过期");
    public static final GcocpException VERIFY_CODE_WAITING = new GcocpException(30004, "验证码重新发送时间");

    public static final GcocpException PARAMETER_ERROR = new GcocpException(110, "参数不正确");
    public static final GcocpException UPLOAD_FILE_ERROR = new GcocpException(111, "文件上传失败.");
    public static final GcocpException UPLOAD_FILE_RANGE_ERROR = new GcocpException(112, "上传的文件文件不能大于1M,且后缀名必须为jpg,jpeg,gif,png.");

    private static final long serialVersionUID = 3424589800181389417L;


    public GcocpException() {
        super();
    }

    public GcocpException(int code, String msgFormat, Object... args) {
        super(code, msgFormat, args);
    }

    public GcocpException(int code, String msg) {
        super(code, msg);
    }

    public static void main(String[] args) {
        BaseException exception = new BaseException(2, "asdfasdf");
        System.out.println("args = " + (exception instanceof BaseException));
    }

    /**
     * 实例化异常
     */
    @Override
    public GcocpException newInstance(String msgFormat, Object... args) {
        return new GcocpException(this.code, msgFormat, args);
    }

    public GcocpException print() {
        log.info("==>GcocpException, code:" + this.code + ", msg:" + this.msg);
        return new GcocpException(this.code, this.msg);
    }
}
